package Boundry;

import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;

import Boundry.GenericTools.IPanelOperation;
import Boundry.GenericTools.InputPanel;
import Controllers.GenericToolsForController.PDFDocument;
import Controllers.GenericToolsForController.PDFfile;

import java.awt.Color;
import javax.swing.border.LineBorder;
import java.awt.SystemColor;
import javax.swing.JTextPane;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;

public class FindRequestGUI extends InputPanel implements IPanelOperation {
	private JTextField textFieldSerachID;
	private JTextField textFieldDate;
	private JTextPane textPaneExscuse_1;
	private JTextPane txtpnNote;
	private JTextPane textPaneDescription;
	private JTextPane textPaneCurrentState;
	private JTextField textFieldInfoSystem;
	private JTextField textFieldInitiator;
	private JButton btnSearch;
	private JTextPane textPaneProposedChange;
	private JTextField textFieldCurrentStatus;
	public JButton btnShowFile;
	
	public PDFfile Filepath;

	/**
	 * Create the panel.
	 */
	public FindRequestGUI() {
		setLayout(null);
		
		JLabel lblSearchRequest = new JLabel("Search Request");
		lblSearchRequest.setFont(new Font("Tahoma", Font.PLAIN, 22));
		lblSearchRequest.setBounds(264, 11, 204, 40);
		mainPanel.add(lblSearchRequest);
		
		JTabbedPane tabbedPaneOptions = new JTabbedPane(JTabbedPane.TOP);
		tabbedPaneOptions.setBounds(10, 50, 865, 294);
		mainPanel.add(tabbedPaneOptions);
	
		JPanel panelOpt1 = new JPanel();
		tabbedPaneOptions.addTab("Search by ID", null, panelOpt1, null);
		panelOpt1.setLayout(null);
		
		JLabel lblId = new JLabel("ID:");
		lblId.setBounds(10, 29, 46, 14);
		panelOpt1.add(lblId);
		
		textFieldSerachID = new JTextField();
		textFieldSerachID.setBounds(40, 26, 205, 20);
		panelOpt1.add(textFieldSerachID);
		textFieldSerachID.setColumns(10);
		
		btnSearch = new JButton("");
		btnSearch.setIcon(new ImageIcon(FindRequestGUI.class.getResource("/GUI/Image/2_action_search.png")));
		
		btnSearch.setBounds(268, 11, 38, 35);
		panelOpt1.add(btnSearch);
		
		JPanel panel = new JPanel();
		panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		panel.setBackground(SystemColor.menu);
		panel.setBounds(10, 59, 818, 196);
		panelOpt1.add(panel);
		panel.setLayout(null);
		
		JLabel lblDescription = new JLabel("Description:");
		lblDescription.setBounds(10, 11, 69, 14);
		panel.add(lblDescription);
		
		JLabel lblDateOfCreation = new JLabel("Date of creation:");
		lblDateOfCreation.setBounds(10, 75, 120, 14);
		panel.add(lblDateOfCreation);
		
		textFieldDate = new JTextField();
		textFieldDate.setBounds(122, 72, 167, 20);
		textFieldDate.setBackground(SystemColor.inactiveCaptionText);
		textFieldDate.setEnabled(false);
		textFieldDate.setEditable(false);
		textFieldDate.setColumns(10);
		panel.add(textFieldDate);
		
		JLabel lblNote = new JLabel("Note:");
		lblNote.setBounds(299, 11, 120, 14);
		panel.add(lblNote);
		
		txtpnNote = new JTextPane();
		txtpnNote.setBounds(381, 11, 177, 53);
		txtpnNote.setBackground(SystemColor.inactiveCaptionText);
		txtpnNote.setEnabled(false);
		txtpnNote.setEditable(false);
		panel.add(txtpnNote);
		
		textPaneDescription = new JTextPane();
		textPaneDescription.setBounds(122, 11, 167, 53);
		textPaneDescription.setBackground(SystemColor.inactiveCaptionText);
		textPaneDescription.setForeground(Color.RED);
		textPaneDescription.setEnabled(false);
		textPaneDescription.setEditable(false);
		panel.add(textPaneDescription);
		
		JLabel lblExcuse = new JLabel("Excuse: ");
		lblExcuse.setBounds(299, 75, 120, 14);
		panel.add(lblExcuse);
		
		textPaneCurrentState = new JTextPane();
		textPaneCurrentState.setBounds(381, 139, 177, 53);
		textPaneCurrentState.setBackground(SystemColor.inactiveCaptionText);
		textPaneCurrentState.setEnabled(false);
		textPaneCurrentState.setEditable(false);
		panel.add(textPaneCurrentState);
		
		JLabel labelCurrentState = new JLabel("Current State:");
		labelCurrentState.setBounds(299, 139, 120, 14);
		panel.add(labelCurrentState);
		
		JLabel lblInfoSystem = new JLabel("Info System:");
		lblInfoSystem.setBounds(10, 131, 120, 14);
		panel.add(lblInfoSystem);
		
		textFieldInfoSystem = new JTextField();
		textFieldInfoSystem.setBounds(122, 128, 167, 20);
		textFieldInfoSystem.setBackground(SystemColor.inactiveCaptionText);
		textFieldInfoSystem.setEnabled(false);
		textFieldInfoSystem.setEditable(false);
		textFieldInfoSystem.setColumns(10);
		panel.add(textFieldInfoSystem);
		
		textFieldInitiator = new JTextField();
		textFieldInitiator.setBounds(122, 100, 167, 20);
		textFieldInitiator.setBackground(SystemColor.inactiveCaptionText);
		textFieldInitiator.setEnabled(false);
		textFieldInitiator.setEditable(false);
		textFieldInitiator.setColumns(10);
		panel.add(textFieldInitiator);
		
		JLabel lblInitiator = new JLabel("Initiator:");
		lblInitiator.setBounds(10, 103, 120, 14);
		panel.add(lblInitiator);
		
		textPaneProposedChange = new JTextPane();
		textPaneProposedChange.setBounds(699, 11, 109, 108);
		textPaneProposedChange.setEnabled(false);
		textPaneProposedChange.setEditable(false);
		textPaneProposedChange.setBackground(SystemColor.inactiveCaptionText);
		panel.add(textPaneProposedChange);
		
		JLabel lblProposedChange = new JLabel("Proposed Change: ");
		lblProposedChange.setBounds(583, 22, 120, 14);
		panel.add(lblProposedChange);
		
		textFieldCurrentStatus = new JTextField();
		textFieldCurrentStatus.setBounds(122, 156, 167, 20);
		textFieldCurrentStatus.setEnabled(false);
		textFieldCurrentStatus.setEditable(false);
		textFieldCurrentStatus.setColumns(10);
		textFieldCurrentStatus.setBackground(SystemColor.inactiveCaptionText);
		panel.add(textFieldCurrentStatus);
		
		JLabel lblCurrentStatus = new JLabel("Current Status:");
		lblCurrentStatus.setBounds(10, 159, 120, 14);
		panel.add(lblCurrentStatus);
		
		btnShowFile = new JButton("");
		btnShowFile.setBounds(709, 139, 89, 41);
		btnShowFile.setEnabled(false);
		btnShowFile.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new PDFDocument(Filepath,"Report Attached to the request");
				
				
			}
		});
		btnShowFile.setBackground(SystemColor.inactiveCaption);
		btnShowFile.setForeground(Color.RED);
		btnShowFile.setIcon(new ImageIcon(FindRequestGUI.class.getResource("/ICONS/4_collections_collection.png")));
		panel.add(btnShowFile);
		
		textPaneExscuse_1 = new JTextPane();
		textPaneExscuse_1.setBounds(383, 75, 175, 53);
		panel.add(textPaneExscuse_1);
		textPaneExscuse_1.setBackground(SystemColor.inactiveCaptionText);
		textPaneExscuse_1.setEnabled(false);
		textPaneExscuse_1.setEditable(false);
		
		btnSubnit.setVisible(false);
		
	}

	public JButton getBtnShowFile() {
		return btnShowFile;
	}

	public void setBtnShowFile(JButton btnShowFile) {
		this.btnShowFile = btnShowFile;
	}

	public JTextField getTextFieldCurrentStatus() {
		return textFieldCurrentStatus;
	}

	public void setTextFieldCurrentStatus(JTextField textFieldCurrentStatus) {
		this.textFieldCurrentStatus = textFieldCurrentStatus;
	}

	public JTextPane getTextPaneProposedChange() {
		return textPaneProposedChange;
	}

	public void setTextPaneProposedChange(JTextPane textPaneProposedChange) {
		this.textPaneProposedChange = textPaneProposedChange;
	}

	public JTextField getTextFieldInitiator() {
		return textFieldInitiator;
	}

	public void setTextFieldInitiator(JTextField textFieldInitiator) {
		this.textFieldInitiator = textFieldInitiator;
	}

	public JButton getBtnSearch() {
		return btnSearch;
	}

	public void setBtnSearch(JButton btnSearch) {
		this.btnSearch = btnSearch;
	}

	public JTextField getTextFieldSerachID() {
		return textFieldSerachID;
	}

	public void setTextFieldSerachID(JTextField textFieldSerachID) {
		this.textFieldSerachID = textFieldSerachID;
	}

	

	public JTextField getTextFieldDate() {
		return textFieldDate;
	}

	public void setTextFieldDate(JTextField textFieldDate) {
		this.textFieldDate = textFieldDate;
	}

	public JTextPane getTextPaneExscuse() {
		return textPaneExscuse_1;
	}

	public void setTextPaneExscuse(JTextPane textPaneExscuse) {
		this.textPaneExscuse_1 = textPaneExscuse;
	}

	public JTextPane getTxtpnNote() {
		return txtpnNote;
	}

	public void setTxtpnNote(JTextPane txtpnNote) {
		this.txtpnNote = txtpnNote;
	}

	public JTextPane getTextPaneDescription() {
		return textPaneDescription;
	}

	public void setTextPaneDescription(JTextPane textPaneDescription) {
		this.textPaneDescription = textPaneDescription;
	}

	public JTextPane getTextPaneCurrentState() {
		return textPaneCurrentState;
	}

	public void setTextPaneCurrentState(JTextPane textPaneCurrentState) {
		this.textPaneCurrentState = textPaneCurrentState;
	}

	public JTextField getTextFieldInfoSystem() {
		return textFieldInfoSystem;
	}

	public void setTextFieldInfoSystem(JTextField textFieldInfoSystem) {
		this.textFieldInfoSystem = textFieldInfoSystem;
	}

	@Override
	public String apHelpButton() {
		return "Search by catgories";
	}

	@Override
	public String setTitle() {
 		return null;
	}
}
